package com.drg.center.controller;

import com.drg.center.entity.param.SysDictListDTO;
import com.drg.center.entity.param.SysIndexAddDTO;
import com.drg.center.entity.param.SysIndexEditDTO;
import com.drg.center.entity.result.SysIndexVO;
import com.guaike.core.entity.result.PageEntity;
import com.guaike.core.entity.result.Result;
import com.drg.center.service.SysIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Author: zhangxilin
 * @Date: 2024/5/21
 */
@RestController
@RequestMapping("/sys/index")
@Api(tags = "系统-系统接口组")
public class SysIndexController {

    @Autowired
    private SysIndexService sysIndexService;

    @PostMapping("/add")
    @ApiOperation(value = "添加")
    public Result<Boolean> add(@Valid @RequestBody SysIndexAddDTO param){
        return sysIndexService.add(param);
    }

    @PostMapping("/edit")
    @ApiOperation(value = "编辑")
    public Result<Boolean> edit(@Valid @RequestBody SysIndexEditDTO param){
        return sysIndexService.edit(param);
    }

    @GetMapping("/findPage")
    @ApiOperation(value = "列表")
    public Result<PageEntity<SysIndexVO>> findPage(@Valid SysDictListDTO param){
        return sysIndexService.findPage(param);
    }

    @GetMapping("/detail")
    @ApiOperation(value = "详情")
    public Result<SysIndexVO> detail(@ApiParam("ID") @RequestParam("id") Long id){
        return sysIndexService.detail(id);
    }
}
